package day_2023_7_to_10;

/**
 * @author haomin
 * @date 2023/07/27 23:52
 **/
public class Day_7_27 {
    class Solution {
        public int search(int[] nums, int target) {
            int l = 0, r = nums.length, mid;
            while(l < r) {
                mid = l + ((r-l) >> 1);
                if(nums[mid] >= target) r = mid;
                else l = mid + 1;
            }
            int count = 0;
            while(l < nums.length && nums[l++] == target) count++;
            return count;
        }
    }
}